/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.qdu.servlet;

import com.qdu.entity.Movie;
import com.qdu.service.MovieService;
import com.qdu.service.impl.MovieServiceImpl;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author Lenovo
 */
@WebServlet("/smovs")
public class SearchMovServlet extends HttpServlet{
    
    MovieService movieServiceImpl = new MovieServiceImpl();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
   
        String keyword = req.getParameter("keyword");
        System.out.println("servlet收到的关键字是："+keyword);
        List<Movie> list=movieServiceImpl.findMoviesByKeyword(keyword);
        req.setAttribute("movlist", list);
        req.getRequestDispatcher("/searchmovlist.jsp").forward(req, resp);
    }

}
